[VBA] Create a recurrent event in Outlook
Posted
by CFP
on Stack Overflow
See other posts from Stack Overflow
or by CFP
Published on 2010-05-30T10:44:55Z
Indexed on
2010/05/30
10:52 UTC
Read the original article
Hit count: 392
Hello everyone!
I'm trying to create annual, all-day events with VBA in outlook 2007. I use the following code, but no matter which conbination of Start, StartDate, End, etc I use, it won't create a whole-day event. Either it gives it default start/end times, or it remove the all-day attribute...
Dim Birthday As Date
'Get the birthday
'...
Dim BDay As AppointmentItem
Dim Pattern As Outlook.RecurrencePattern
Set BDay = Application.CreateItem(olAppointmentItem)
Set Pattern = BDay.GetRecurrencePattern
Pattern.RecurrenceType = olRecursYearly
Pattern.DayOfMonth = Day(Birthday)
Pattern.MonthOfYear = Month(Birthday)
Pattern.PatternStartDate = Birthday
Pattern.NoEndDate = True
BDay.AllDayEvent = True
BDay.Subject = Contact.FullName
BDay.Save
When created directly in outlook, entries start on the birth day and end 24 hours later. Yet trying to set Start and End this way results in errors. Plus, entries created outlook have no start/end time in the recurrence pattern (well, they are all-day entries...)
Ideas, anybody?
Thanks!
© Stack Overflow or respective owner